package com.hospital.doctor.doctorg.controller;

import com.hospital.doctor.doctorg.service.Totalbillservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @ClassName: TotalbillController
 * @description：
 * @author：TanKai
 * @date：2021/9/26 17:50
 * @versions：v1.0
 */
@Controller
@RequestMapping("/total")
public class TotalbillController {

    @Autowired
    private Totalbillservice totalbillservice;

    @RequestMapping("/statistical")
    public String cx(Model model) {
        //得到药品的总收入
        Double drugcost = totalbillservice.drugcost();
        //得到挂号的总收入
        Double guahaocost = totalbillservice.guahaocost();
        //得到检查的总收入
        Double checkcost = totalbillservice.checkcost();
        //将收入写入数组转发页面
        Double[] arr = new Double[4];
        arr[0] = drugcost;
        arr[1] = guahaocost;
        arr[2] = checkcost;
        arr[3] = (drugcost + guahaocost + checkcost);
        model.addAttribute("arr", arr);
        return "doctor/statistics";
    }

}
